//
//  InstagramMediaShareCommunity.m
//  MediaShareBB
//
//  Created by Artak Gevorgyan on 7/4/13.
//  Copyright (c) 2013 InnoriseEntertainment. All rights reserved.
//

#import "InstagramMediaShareCommunity.h"
#import "MediaShareBBUtilityMethods.h"
#import "MediaShareData.h"

@interface InstagramMediaShareCommunity()
{
	MediaShareData* _sharedMediaData;
}

@end

@implementation InstagramMediaShareCommunity

-(id) init {
	self = [super init];
	if (self) {
		super.name = @"Instagram";
		super.communityType = MEDIA_SHARE_COMMUNITY_INSTAGRAM;
		super.supportedMediaTypes = [[NSArray alloc] initWithObjects:
									 [NSNumber numberWithInt:IMAGE_MEDIA_TYPE],nil];
	}
	return self;
}

#pragma mark - Superclass methods

// Superclass method
-(NSString*) description {
	NSString* d = @"Instagram description";
	return d;
}

// Superclass method
-(void) configureWithCredentials:(NSDictionary*) credentials {
}

// Superclass method
-(void) login {
	if ([MediaShareBBUtilityMethods isObject:super.delegate
						  respondsToSelector:@selector(loginSuccess)]) {
		[super.delegate loginSuccess];
	}
}

//Superclass method
-(void) loginWithAnotherUser {
    NSLog(@"%@", self.class);
}

//Superclass method
-(NSString*) getUserName {
    return @"";
}

//Superclass method
-(NSString*) sharedMediaLink {
    return @"";
}

// Superclass method
-(void) shareMedia:(MediaShareData*) data {
	if ([super isValidMediaType:data.mediaType]) {
		_sharedMediaData = data;
		if ([MediaShareBBUtilityMethods isObject:super.delegate
							  respondsToSelector:@selector(willSharingMedia:through:)]) {
			[super.delegate willSharingMedia:_sharedMediaData
									 through:self];
		}
	} else {
		NSLog(@"%s: Unsupported media type:%d", __PRETTY_FUNCTION__, data.mediaType);
	}
}

@end
